package com.mo.design.pattern.behavior.memento;

public class CarCaretaker {
    public static void main(String[] args) {
        new CarCaretaker().runMechaincTest();
    }

    private void runMechaincTest() {
        CarOriginator.Memento savedState = new CarOriginator.Memento("");
        CarOriginator originator = new CarOriginator();
        originator.setState("state1");
        originator.setState("state2");
        savedState = originator.saveState();
        originator.setState("state3");
        originator.restoreState(savedState);
        System.out.println("final state: " + originator.getState());
    }


}
